package com.imc.api.shopmall.dao;

import com.imc.api.attence.pojo.Lesson;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * Created by tanweiping on 2018/9/28.
 */
@Mapper
public interface ShopMallMapper {

    /*
     * YT  2018/10/28 21:52
     * 方法描述：根据登陆名称获取商城信息
     */
    @Select("SELECT true as selected, shopmall.*,lesson.id as skuId,lesson.lessonName as title,lesson.price,lesson.photo as image FROM t_shopmall shopmall LEFT JOIN t_user u ON u.id = shopmall.userId LEFT JOIN t_lesson lesson on lesson.id = shopmall.skuId WHERE u.loginName=#{loginName} AND shopmall.status = 0")
    List <Map <String, Object>> findAllByLoginName(@Param("loginName") String loginName);

    /*
     * YT  2018/10/28 21:52
     * 方法描述：插叙课程列表
     */
    @Select("select * from t_lesson where id in (${skuIds})")
    List <Lesson> queryLessonList(@Param("skuIds") String skuIds);
}
